<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Head-to-head comparison of Phar, Tar and Zip</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="phar.fileformat.stub.html">Phar file stub</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="phar.fileformat.tar.html">Tar-based phars</a></div>
 <div class="up"><a href="phar.fileformat.html">What makes a phar a phar and not a tar or a zip?</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="phar.fileformat.comparison" class="section">
  <h2 class="title">Head-to-head comparison of Phar, Tar and Zip</h2>
  <p class="para">
   What are the good and the bad things about the three supported file formats in
   the phar extension?  This table attempts to address that question.
  <table class="doctable table">
   <caption><strong>Feature matrix: Phar vs. Tar vs. Zip</strong></caption>
   
    <thead>
     <tr>
      <th>Feature</th>
      <th>Phar</th>
      <th>Tar</th>
      <th>Zip</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>Standard File Format</td>
      <td>No</td>
      <td>Yes</td>
      <td>Yes</td>
     </tr>

     <tr>
      <td>Can be executed without the Phar Extension
       <a href="phar.fileformat.comparison.html#phar.fileformat.phartip" class="link">[1]</a>
      </td>
      <td>Yes</td>
      <td>No</td>
      <td>No</td>
     </tr>

     <tr>
      <td>Per-file compression</td>
      <td>Yes</td>
      <td>No</td>
      <td>Yes</td>
     </tr>

     <tr>
      <td>Whole-archive compression</td>
      <td>Yes</td>
      <td>Yes</td>
      <td>No</td>
     </tr>

     <tr>
      <td>Whole-archive signature validation</td>
      <td>Yes</td>
      <td>Yes</td>
      <td>Yes (PHP 5.3.1+)</td>
     </tr>

     <tr>
      <td>Web-specific application support</td>
      <td>Yes</td>
      <td>Yes</td>
      <td>Yes</td>
     </tr>

     <tr>
      <td>Per-file Meta-data</td>
      <td>Yes</td>
      <td>Yes</td>
      <td>Yes</td>
     </tr>

     <tr>
      <td>Whole-Archive Meta-data</td>
      <td>Yes</td>
      <td>Yes</td>
      <td>Yes</td>
     </tr>

     <tr>
      <td>Archive creation/modification
       <a href="phar.fileformat.comparison.html#phar.fileformat.phartip2" class="link">[2]</a>
      </td>
      <td>Yes</td>
      <td>Yes</td>
      <td>Yes</td>
     </tr>

     <tr>
      <td>Full support for all stream wrapper functions</td>
      <td>Yes</td>
      <td>Yes</td>
      <td>Yes</td>
     </tr>

     <tr>
      <td>Can be created/modified even if phar.readonly=1
       <a href="phar.fileformat.comparison.html#phar.fileformat.phartip3" class="link">[3]</a>
      </td>
      <td>No</td>
      <td>Yes</td>
      <td>Yes</td>
     </tr>

    </tbody>
   
  </table>

  </p>
  <p class="para" id="phar.fileformat.phartip">
   <div class="tip"><strong class="tip">Tip</strong>
    <p class="para">
    [1] PHP can only directly access the contents of a Phar archive
    without the Phar extension if it is using a <em>stub</em>
    that extracts the contents of the phar archive.  The stub
    created by <span class="function"><a href="phar.createdefaultstub.html" class="function">Phar::createDefaultStub()</a></span> extracts
    the phar archive and runs its contents from a temporary directory
    if no phar extension is found.
    </p>
   </div>
  </p>
  <p class="para" id="phar.fileformat.phartip2">
   <div class="tip"><strong class="tip">Tip</strong>
    <p class="para">
    [2] All write access requires <em>phar.readonly</em> to
    be disabled in php.ini or on the command-line directly.
    </p>
   </div>
  </p>
  <p class="para" id="phar.fileformat.phartip3">
   <div class="tip"><strong class="tip">Tip</strong>
    <p class="para">
    [3] Only tar and zip archives without <em>.phar</em> in their
    filename and without an executable stub <em>.phar/stub.php</em>
    can be created if phar.readonly=1.
    </p>
   </div>
  </p>
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="phar.fileformat.stub.html">Phar file stub</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="phar.fileformat.tar.html">Tar-based phars</a></div>
 <div class="up"><a href="phar.fileformat.html">What makes a phar a phar and not a tar or a zip?</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
